Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
glob-watcher
Advanced tools
The glob-watcher package is a wrapper around the chokidar library, providing a way to watch file sets defined with glob patterns for changes. It is commonly used in build tools and scripts to automate tasks like reloading, testing, or compiling code when changes are detected in the file system.
Watching files for changes
This feature allows you to monitor a set of files defined by glob patterns for any changes. When a change is detected, a callback function is executed. It's useful for triggering rebuilds or tests automatically during development.
const { watch } = require('glob-watcher');
watch(['src/**/*.js'], (done) => {
console.log('Files have changed!');
done();
});
Debouncing and throttling events
This feature helps in controlling the rate at which events are handled. By debouncing or throttling, you can limit the number of times your callback function is called, which is particularly useful for reducing unnecessary processing during rapid file changes.
const { watch } = require('glob-watcher');
const watcher = watch('src/**/*.js', { delay: 100 });
watcher.on('change', (path) => console.log(`${path} has changed`));
Chokidar is a more direct and flexible file watching library that glob-watcher depends on. It offers more detailed control over file watching events and options, making it a good choice for projects that need fine-grained event handling.
Watchify is a browserify plugin that provides a similar file watching capability, specifically optimized for incremental builds with Browserify. While it serves a similar purpose to glob-watcher, it is more tightly integrated with the Browserify ecosystem.
Nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected. It's similar to glob-watcher but is more focused on server-side applications.
Package | glob-watcher |
Description | Watch globs |
Node Version | >= 0.9 |
var watch = require('glob-watcher');
// callback interface
watch(["./*.js", "!./something.js"], function(evt){
// evt has what file changed and all that jazz
});
// EE interface
var watcher = watch(["./*.js", "!./something.js"]);
watcher.on('change', function(evt) {
// evt has what file changed and all that jazz
});
// add files after it has been created
watcher.add("./somefolder/somefile.js");
FAQs
Watch globs and execute a function upon change, with intelligent defaults for debouncing and queueing.
The npm package glob-watcher receives a total of 623,379 weekly downloads. As such, glob-watcher popularity was classified as popular.
We found that glob-watcher demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.